<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class OrderShirt extends Model
{
    /**
     * 运费，单位：分
     */
    const SHIPPING = 0;

    /**
     * 订单总价(不包含运费，单位：分)
     */
    const ORDER_AMOUNT = 19900;

    /**
     * 订单合计总价(用户支付的费用 = 运费 + 订单总价，单位：分)
     */
    const AMOUNT = self::SHIPPING + self::ORDER_AMOUNT;

    protected $table = 'order_shirt';

    protected $fillable = [
        'order_number', 'status', 'payment_status', 'payment_at', 'order_from', 'openid', 'unionid',
        'wechat_nickname', 'shirt_mianliao', 'shirt_lingxing', 'shirt_xiuxing', 'shirt_xiuzi',
        'shirt_xiuzicolor', 'shirt_xiuzicontent', 'height', 'weight', 'shirt_xiongxing', 'shirt_jianxing',
        'shirt_fuxing', 'shirt_beibu', 'recipient_phone', 'recipient_name', 'recipient_area',
        'recipient_address', 'buyer_phone', 'remarks', 'created_at', 'updated_at',
    ];

    public function getPaymentAtAttribute($value)
    {
        return date('Y-m-d H:i:s', $value);
    }
}
